Previous Book Contents Book Index Next

Inside Macintosh: AppleScript Finder Guide /
Chapter 2 - Finder Objects / Object Class Definitions


Container Window

An object of class Container Window is a window for a container. For example, the windows for a disk, a folder, or a suitcase are all container windows, while a control panel window, the About This Macintosh window, and an information window are not.

PROPERTIES
A container window has all the properties defined for object class Window on page 93: Bounds, Closeable, Floating, Index, Modal, Position, Resizable, Titled, Visible, Zoomable, and Zoomed.

Unlike other windows, a container window also has these properties:

container
A reference to the container to which the container
window belongs.
Class: Reference
Modifiable: No
disk
A reference to the disk on which the container to which the window belongs is stored.
Class: Reference
Modifiable: No
folder
A reference to the folder to which the container window belongs (available only for container windows of folders).
Class: Reference
Modifiable: No
item
A reference to the item to which the container window belongs.
Class: Reference
Modifiable: No
previous list view
An integer between 2 and 8 or one of the corresponding constants name, modification date, size, kind, comment, label index, or version. If the View property of the container window is currently one of these list views, the value of this property is the current list view. If the View property is small icon or icon, the value of this property is the last list view selected. If no list view has been selected since the container window was first opened, the value of this property is name.
You can't get or set this property unless the container window
is open, and the value of the property isn't retained after the container window has been closed.
Class: Integer
Modifiable: No
selection
A reference to the current selection.
Class: Reference or list of references
Modifiable: No
view
An integer between 0 and 8 or one of the corresponding constants small icon, icon, name, modification date, size, kind, comment, label index, or version, indicating the current selection in the View menu for the container window. You can't get or set this property unless the container window is open.
Class: Integer
Modifiable: Yes
ELEMENT CLASSES
The elements of a container window include all the items currently displayed inside the window. When folders in a window whose View property is name, date, size, or kind are expanded in outline view, the elements of the expanded folder become elements of the container window in which the folder is located.

Objects of the classes listed here can be identified at the top level of a container window by name or by number. Page numbers indicate the location of definitions in this chapter.

Accessory Suitcase (page 27)
Alias File (page 28)
Application File (page 38)
Container (page 42)
Control Panel (page 51)
Desk Accessory File (page 54)
Document File (page 59)
File (page 60)
Folder (page 62)
Font File (page 64)
Font Suitcase (page 65)
Item (page 72)
Sharable Container (page 78)
Sound File (page 86)
Suitcase (page 88)
COMMANDS HANDLED
Clean Up, Close, Count, Data Size, Exists, Get, Open, Print, Sort, Update

DEFAULT VALUE CLASS RETURNED
Reference to a file or, if you use the plural form container windows, a list
of references.

EXAMPLE
The script that follows tiles all the open container windows in an overlapping pattern and sets each window's View property to 3 ("by Names").

set {a, b, c, d} to {4, 44, 267, 311}
tell application "Finder"   repeat with n from 1 to (count of container windows)
      if n = 1 then
         set bounds of container window n to {a, b, c, d}
      else
         set {a, b, c, d} to {a + 20, b + 20, c + 20, d + 20}
         set tiledBounds to {a, b, c, d}
         set bounds of container window n to tiledBounds
      end if
      set view of container window n to 3
      open container window n
   end repeat
end tell 
The phrase count of container windows at the beginning of the Repeat loop requests that the Finder count all the container windows. Windows that aren't container windows, such as information windows, are ignored. The Finder returns an integer, which the Repeat statement uses as the number
of times to repeat.

The If statement within the Repeat statement resets the bounds of each successive container window so that it is shifted down and to the right from the previously tiled window. After the View for each container window is set, the last statement within the Repeat statement sends an Open command to that window so that it overlaps the previously tiled window.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
13 JUL 1996